package com.example.tanlee.ocrgraduation.application;

import android.app.Application;

import com.example.tanlee.ocrgraduation.bean.data.GlobalData;
import com.example.tanlee.ocrgraduation.util.ImageLoaderUtil;
import com.example.tanlee.ocrgraduation.util.MyLog;
import com.nostra13.universalimageloader.core.ImageLoader;

/**
 * 应用的Application组件
 * Created by Tanlee on 2017/1/23.
 */
public class MyApplication extends Application{

    private static ImageLoader imageLoader = ImageLoader.getInstance();
    private static GlobalData globalData = null; // 存储在内存中全局变量

    public static int count = 0; //作弊计数
    static MyLog log = MyLog.tanliLog();

    /**
     * 单例模式 需要初始化
     */
    private static MyApplication mInstance;

    @Override
    public void onCreate() {
        super.onCreate();
        // 初始化ImageLoader
        imageLoader.init(ImageLoaderUtil
                .getimageconfig(getApplicationContext()));
    }

    public static MyApplication getInstance() {
        return mInstance;
    }

    public static GlobalData getGlobalData() {
        return globalData;
    }

    public static void setGlobalData(GlobalData globalData) {
        MyApplication.globalData = globalData;
    }

    /**
     * 取得ImageLoader
     * @return
     */
    public static ImageLoader getImageLoader() {
        return imageLoader;
    }




}
